package com.example.demo.controller;

import com.example.demo.common.wrapper.BackResult;
import com.example.demo.pojo.qo.UserQo;
import com.example.demo.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author xcy
 * @Desc
 * @date 2021/3/23 22:53
 * @Version v1.0
 */
@Api(description = "用户有关")
@RestController
@RequestMapping("user")
public class UserController extends BaseController {

    @Autowired
    private UserService userService;

    //@ApiOperation(value = "用户列表查询")
    //@GetMapping
    //public List list(@ModelAttribute UserQo qo) {
    //    return userService.list(qo);
    //}


    //@RequestLog("付汇列表")
    //public BackResult list(@ModelAttribute UserQo qo) {
    //    return BackResult.successBack(userService.list(qo));
    //}

    @ApiOperation(value = "用户列表查询")
    @GetMapping
    public BackResult list(@ModelAttribute UserQo qo) {

        return BackResult.successBack(userService.list(qo));
    }


/**
    @ApiOperation("根据ID查询一个用户")
    @GetMapping("findOne/{id}")
    @WebLog(description = "请求了根据ID查询一个用户")
    public User findOneById(@PathVariable Integer id){
        User user = userService.findOneById(id);
        return user;
    }

    @ApiOperation("增加一个用户")
    @PostMapping("insertOne")
    @WebLog(description = "请求了增加一个用户")
    public void insetOne(@ModelAttribute User user){
        userService.addOne(user);
    }

    @ApiOperation("删除一个用户")
    @DeleteMapping("deleteOneById/{id}")
    @WebLog(description = "请求了删除一个用户")
    public void deleteOneById(@PathVariable Integer id){
        userService.deleteOneById(id);
    }

    @ApiOperation("修改一个用户")
    @PutMapping("updateById/{id}")
    @WebLog(description = "请求了修改一个用户")
    public void updateById(@PathVariable Integer id){
        userService.updateById(id);
    }

    **/

}
